package com.tul.exercise.base.clazz.base.eg6;

import com.tul.exercise.base.clazz.base.eg6.base.*;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @ClassName LiteralPetCreator
 * @Description TODO
 * @Author tul 2018/10/13
 * @Version 1.0
 **/
public class LiteralPetCreator extends PetCreator {
    /**
     * 所有Pet子类的类型List
     */
    public static final List<Class<? extends Pet>> allTypes =
            Stream.of(Pet.class, Dog.class, Cat.class, Rodent.class, Mutt.class,
                    Pug.class, EgyptianMau.class, Manx.class, Cymric.class,
                    Rat.class, Mouse.class, Hamster.class).collect(Collectors.toList());

    /**
     * 用户创建随机Pet子类实例
     */
    private static final List<Class<? extends Pet>> types = allTypes.subList(allTypes.indexOf(Mutt.class), allTypes.size());
    @Override
    public List<Class<? extends Pet>> types() {
        return types;
    }
}
